/*
 * @Author: dfh
 * @Date: 2021-09-23 19:08:13
 * @LastEditors: dfh
 * @Modified By: dfh
 */
import React from 'react'
import { Layout } from 'antd';
import { Cascader } from 'antd';
import { mockData } from '../data';
const { Header } = Layout;
function Index() {
    const [data, setData] = React.useState();

    React.useEffect(() => {
        computedData(mockData);
        setData([mockData]);
    }, [])

    const computedData = (data) => {
        data.value = data.label;
        if (data.children && data.children.length > 0) {
            for (let i = 0; i < data.children.length; i++) {
                computedData(data.children[i]);
            }
        }
    }

    return (
        <Header>
            <Cascader
                options={data}
                expandTrigger="hover"
            />
        </Header>
    )
}

export default Index